-
Notifications
You must be signed in to change notification settings - Fork 260
fix dualnic windows duplicated routes issue #4136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses duplicated route issues in dual NIC Windows scenarios by introducing a conditional check on the SkipDefaultRoutes flag before adding default routes in multitenancy configurations. The fix refactors the routing logic to be more defensive about when routes are added, preventing HNS (Host Network Service) from receiving duplicate default routes.
Key Changes:
- Introduced new
addDefaultRoutemethod on theMultitenancystruct with IPv4 gateway validation and proper error handling - Added conditional route addition based on
SkipDefaultRoutesflag to prevent duplicate routes in dual NIC scenarios - Enhanced test coverage with a new test case verifying that routes are not added when
SkipDefaultRoutes=true
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| cni/network/multitenancy.go | Added new receiver method addDefaultRoute with IP validation; refactored SetupRoutingForMultitenancy to check SkipDefaultRoutes before adding default routes; removed DNS SNAT route handling from the non-SNAT path |
| cni/network/multitenancy_test.go | Updated existing test case name for clarity; added new test case for SkipDefaultRoutes=true scenario; improved code formatting and added missing multitenancyClient initialization |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]> Signed-off-by: Paul Yu <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Paul Yu <[email protected]>
|
/azp run Azure Container Networking PR |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run Azure Container Networking PR |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run Azure Container Networking PR |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run Azure Container Networking PR |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Reason for Change:
This PR is to fix dualnic windows duplicated route issues
Once DNS config sets skipDefaultRoute to True, then do not set default route on this interface. For example:
eth0(skipDefaultRoute=False) -> CNI sets default route to eth0 interface
eth1(skipDefaultRoute=True) -> CNI does not set default route to eth1 interface and leave Routes field as empty.
We are providing two HCN endpoints to HNS:
Endpoint 1 (eth0) – includes a default route.
Endpoint 2 (eth1) – the Routes field is empty, i.e. we are not supplying any route for this endpoint. The only default route we configure is on the first HCN endpoint.
Issue Fixed:
Requirements:
Notes: